package Dao;

import java.util.Hashtable;

import DataClasses.Apt;
import DataClasses.Condo;
import DataClasses.Gas;
import DataClasses.Homestay;
import DataClasses.House;
import DataClasses.Restaurant;
import DataClasses.School;
import DataClasses.Shop;
import DataClasses.Townhouse;
import DataClasses.Transportation;

public class LUDAO {
	private String aptKey = "Apt";
	private String condoKey = "Condo";
	private String gasKey = "Gas";
	private String homestayKey = "Homestay";
	private String houseKey = "House";
	private String restaurantKey = "Restaurant";
	private String schoolKey = "School";
	private String shopKey = "Shop";
	private String townhouseKey = "Townhouse";
	private String transportationKey = "Transportation";

	private Hashtable<String, Hashtable<Integer, Object>> building, facility;

	private Hashtable<Integer, Object> Apts, Condos, Gas, Homestays, Houses,
			Restaurants, Shops, Townhouses, Transportations, schools;

	 //public static void main(String[] args) {
	 //LUDAO Databases = new LUDAO();
	// }

	public LUDAO() {

		building = new Hashtable<String, Hashtable<Integer, Object>>();
		facility = new Hashtable<String, Hashtable<Integer, Object>>();
		Apts = new Hashtable<Integer, Object>();
		Condos = new Hashtable<Integer, Object>();
		Gas = new Hashtable<Integer, Object>();
		Homestays = new Hashtable<Integer, Object>();
		Houses = new Hashtable<Integer, Object>();
		Restaurants = new Hashtable<Integer, Object>();
		Shops = new Hashtable<Integer, Object>();
		Townhouses = new Hashtable<Integer, Object>();
		Transportations = new Hashtable<Integer, Object>();
		schools = new Hashtable<Integer, Object>();

		addSchool("U of T", convert(-79,-23,-47.36),convert(43,39,35.27), 5, 5);
		addSchool("OCAD University", convert(-79,-23,-28.89), convert(43,39,12.01), 5, 4);
		addSchool("Ryerson University", convert(-79,-22,-42.77),convert(43,39,27.32), 5, 4);

		addRest("Kinton Ramen",convert(-79,-23,-38.15), convert(43,39,20.87) , 1, 5);
		addRest("Le Papillon", convert(-79,-22,-24.05),convert(43,38,54.79), 2, 4);
		addRest("Wish", convert(-79,-23,-08.56),convert(43,40,07.40) , 3, 3);

		addShop("Eaton center", convert(-79,-22,-52.38),convert(43,39,18.29), 3);
		addShop("Atrium on Bay", convert(-79,-22,-59.84),convert(43,39,21.29), 1);
		addShop("Loblaws", convert(-79,-22,-48.42),convert(43,39,42.43), 2);

		addGas("ESSO", convert(-79,-22,-37.79),convert(43,39,24.28), 2);
		addGas("Shell", convert(-79,-21,-48.78),convert(43,39,17.42), 2);
		addGas("Petro-Canada", convert(-79,-23,-39.88),convert(43,38,41.70), 2);

		addTrans("Queens Park", convert(-79,-23,-25.76),convert(43,39,35.55), 1);
		addTrans("College", convert(-79,-22,-59.09),convert(43,39,40.85), 1);
		addTrans("Union", convert(-79,-22,-56.09),convert(43,38,43.88), 1);
		addTrans("Queen", -79.379616,43.652738, 1);
		
		addCondo("Churchill Park Condo", 500000, 80,2,2,1,1,23, convert(-79,-24,-13.90), convert(43,40,00.29), 2);
		addCondo("Polo Club 2", 600000, 85,2,2,1,1,40,  convert(-79,-23,-15.21),convert(43,39,57.33), 2);
		addCondo("Aqua Condo", 350000, 60,1,1,0,1,30, convert(-79,-23,-28.84),convert(43,39,17.53), 2);
		addCondo("CASA", 450000, 70,2,1,1,1,20, convert(-79,-23,-05.18), convert(43,40,08.04), 2);
		addCondo("Metropole", 750000, 110,3,2,2,1,36, convert(-79,-22,-37.06),convert(43,38,57.64), 2);
		addCondo("MURANO CONDOS", 530000, 89,2,2,1,1,36,-79.385828, 43.661687, 2);
		addCondo("Murano Condos", 550000, 99,2,2,1,1,36,-79.386335,43.66248,2);
		addCondo("Lumiere Condos", 620000, 80,2,2,1,1,36,-79.385856,43.660266,2);
		addCondo("Burano Condos", 730000, 80,2,2,1,1,36,43.661601,-79.386101,2);
		
		
	}

	public void addSchool(String name, double longitude, double latitude,
			int schoolType, int rating) {

		School newSchool = new School(name, longitude, latitude, schoolType,
				rating);
		int num = schools.size();
		schools.put(num, newSchool);
		building.put(schoolKey, schools);
	}

	public void addRest(String name, double longitude, double latitude,
			int restType, int rating) {

		Restaurant newRest = new Restaurant(name, longitude, latitude,
				restType, rating);
		int num = Restaurants.size();
		Restaurants.put(num, newRest);
		building.put(schoolKey, Restaurants);
	}

	public void addShop(String name, double longitude, double latitude, int size) {

		Shop newShop = new Shop(name, longitude, latitude, size);
		int num = Shops.size();
		Shops.put(num, newShop);
		building.put(schoolKey, Shops);
	}

	public void addGas(String name, double longitude, double latitude,
			int gasType) {

		Gas newGas = new Gas(name, longitude, latitude, gasType);
		int num = Gas.size();
		Gas.put(num, newGas);
		building.put(schoolKey, Gas);
	}

	public void addTrans(String name, double longitude, double latitude,
			int transType) {

		Transportation newTrans = new Transportation(name, longitude, latitude,
				transType);
		int num = Transportations.size();
		Transportations.put(num, newTrans);
		building.put(schoolKey, Transportations);
	}

	public void addCondo(String name, int price, int size,
			int livingroomNumber, int bathroomNumber, int parkingSpot,
			int parkingType, int floor, double longitude, double latitude,
			int type) {

		Condo newCondo = new Condo(name, price, size, livingroomNumber,
				bathroomNumber, parkingSpot, parkingType, floor, longitude,
				latitude, type);
		int num = Condos.size();
		Condos.put(num, newCondo);
		building.put(condoKey, Apts);
	}

	public Hashtable<Integer, Object> getApt() {
		return Apts;
	}

	public Hashtable<Integer, Object> getCondo() {
		return Condos;
	}

	public Hashtable<Integer, Object> getGas() {
		return Gas;
	}

	public Hashtable<Integer, Object> getHomestay() {
		return Homestays;
	}

	public Hashtable<Integer, Object> getRestaurant() {
		return Restaurants;
	}

	public Hashtable<Integer, Object> getSchool() {
		return schools;
	}

	public Hashtable<Integer, Object> getShop() {
		return Shops;
	}

	public Hashtable<Integer, Object> getTownhouse() {
		return Townhouses;
	}

	public Hashtable<Integer, Object> getTransportations() {
		return Transportations;
	}
	
	public double convert(double day, double min, double sec){
		double conv = day+ min/60+sec/3600;
		return conv;
	}

}
